{% extends 'TopxiaAdminBundle:System:operation.layout.html.twig' %}

{% block title %}课程设置 - {{ parent() }}{% endblock %}

{% set submenu = 'course_setting' %}
{% set script_controller = 'setting/course' %}
{% block maincontent %}
<div class="page-header"><h1>课程设置</h1></div>

{{ web_macro.flash_messages() }}

<form class="form-horizontal" method="post" id="course-form" novalidate>

  <fieldset>
    <div class="form-group">
      <div class="col-md-3 control-label">
        <label >给新学员发送欢迎私信</label>
      </div>
      <div class="controls col-md-8 radios">
        {{ radios('welcome_message_enabled', {1:'开启', 0:'关闭'}, courseSetting.welcome_message_enabled) }}
      <p class="help-block">开启后，新学员加入课程后，会收到教师的欢迎私信</p>
      </div>
    </div>

    <div class="form-group">
      <div class="col-md-3 control-label">
        <label for="welcome_message_body">欢迎私信内容</label>
      </div>
      <div class="controls col-md-8">
        <textarea id="welcome_message_body" name="welcome_message_body" class="form-control" rows="5">{{ courseSetting.welcome_message_body }}</textarea>
        <div class="help-block">
          {% verbatim %}
          <div>变量说明：</div>
          <ul>
            <li>{{nickname}} 为接收方用户昵称</li>
            <li>{{course}} 为课程名称</li>
          </ul>
          {% endverbatim %}
        </div>
      </div>
    </div>

    <div class="form-group">
      <div class="col-md-3 control-label">
        <label >购买课程时填写个人资料</label>
      </div>
      <div class="controls col-md-8 radios">
        {{ radios('buy_fill_userinfo', {1:'开启', 0:'关闭'}, courseSetting.buy_fill_userinfo) }}
      <p class="help-block">开启后，学员购买课程时，需填写个人资料</p>
      </div>
      <div class="controls col-md-8 col-md-offset-3"  id="show-list">
        {% for sort in courseSetting.userinfoFields%}
            {% if sort=='truename' %}
            <button type="button" class="btn btn-default btn-xs">真实姓名</button>
            {% endif %}
            {% if sort=='mobile' %}
            <button type="button" class="btn btn-default btn-xs">手机号码</button>
            {% endif %}
            {% if sort=='qq' %}
            <button type="button" class="btn btn-default btn-xs">QQ</button>
            {% endif %}
            {% if sort=='company' %}
            <button type="button" class="btn btn-default btn-xs">所在公司</button>
            {% endif %}
            {% if sort=='idcard' %}
            <button type="button" class="btn btn-default btn-xs">身份证号码</button>
            {% endif %}
             {% if sort=='gender' %}
            <button type="button" class="btn btn-default btn-xs">性别</button>
            {% endif %}
             {% if sort=='job' %}
            <button type="button" class="btn btn-default btn-xs">职业</button>
            {% endif %}
             {% if sort=='weibo' %}
            <button type="button" class="btn btn-default btn-xs">微博</button>
            {% endif %}
             {% if sort=='weixin' %}
            <button type="button" class="btn btn-default btn-xs">微信</button>
            {% endif %}
            {% if  userFields %}
                {% for field in userFields %}
                      {% if sort==field.fieldName %}
                           <button type="button" class="btn btn-default btn-xs">{{field.title}}</button>
                     {% endif %}
                {% endfor %}
            {% endif %}
        {% endfor %}
        <div class="pull-right "><a href="javascript:" id="show-list-btn">编辑 <span class="
  glyphicon glyphicon-chevron-down"></span></a></div>
      </div>
      <div  class="controls col-md-8 col-md-offset-2" id="buy-userinfo-list">
            <div class="form-group"><ul class="buy-userinfo-list sortable-list" data-role="list">
            {% if courseSetting.userinfoFieldNameArray %}
            {% for sort in courseSetting.userinfoFieldNameArray %}
               {% if sort=='truename' %}
                <li class="list-group-item clearfix" data-role="item" >
                  <span class="glyphicon glyphicon-resize-vertical sort-handle"></span>
                  &nbsp;<input type="checkbox" name="userinfoFields[]" value="truename"  {% for sort in courseSetting.userinfoFields %}{% if sort=="truename"%}checked=true{% endif %}{% endfor %}></input><input type="hidden"  name="userinfoFieldNameArray[]" value="truename"></input> 真实姓名
                </li>
               {% endif %}
               {% if sort=='mobile' %}
                  <li class="list-group-item clearfix" data-role="item" >
                    <span class="glyphicon glyphicon-resize-vertical sort-handle"></span>
                    &nbsp;<input type="checkbox" name="userinfoFields[]" value="mobile" {% for sort in courseSetting.userinfoFields %}{% if sort=="mobile"%}checked=true{% endif %}{% endfor %}></input><input type="hidden"  name="userinfoFieldNameArray[]" value="mobile"></input> 手机号码(带格式校检)
                  </li>
               {% endif %}
               {% if sort=='qq' %}
                      <li class="list-group-item clearfix" data-role="item" >
                      <span class="glyphicon glyphicon-resize-vertical sort-handle"></span>
                      &nbsp;<input type="checkbox"  {% for sort in courseSetting.userinfoFields %}{% if sort=="qq"%}checked=true{% endif %}{% endfor %}  name="userinfoFields[]" value="qq"></input><input type="hidden"  name="userinfoFieldNameArray[]" value="qq"></input> QQ（带格式校验）
                    </li>
               {% endif %}
               {% if sort=='company' %}
                    <li class="list-group-item clearfix" data-role="item" >
                      <span class="glyphicon glyphicon-resize-vertical sort-handle"></span>
                      &nbsp;<input type="checkbox" {% for sort in courseSetting.userinfoFields %}{% if sort=="company"%}checked=true{% endif %}{% endfor %} name="userinfoFields[]" value="company"></input><input type="hidden"  name="userinfoFieldNameArray[]" value="company"></input> 所在公司
                    </li>
               {% endif %}
               {% if sort=='idcard' %}
                <li class="list-group-item clearfix" data-role="item" >
                  <span class="glyphicon glyphicon-resize-vertical sort-handle"></span>
                  &nbsp;<input type="checkbox" {% for sort in courseSetting.userinfoFields %}{% if sort=="idcard"%}checked=true{% endif %}{% endfor %} name="userinfoFields[]" value="idcard"></input><input type="hidden"  name="userinfoFieldNameArray[]" value="idcard"></input> 身份证号码(带格式校检)
                </li>
               {% endif %}
               {% if sort=='gender' %}
                <li class="list-group-item clearfix" data-role="item" >
                  <span class="glyphicon glyphicon-resize-vertical sort-handle"></span>
                  &nbsp;<input type="checkbox" {% for sort in courseSetting.userinfoFields %}{% if sort=="gender"%}checked=true{% endif %}{% endfor %} name="userinfoFields[]" value="gender"></input><input type="hidden"  name="userinfoFieldNameArray[]" value="gender"></input> 性别
                </li>
               {% endif %}
               {% if sort=='job' %}
                <li class="list-group-item clearfix" data-role="item" >
                  <span class="glyphicon glyphicon-resize-vertical sort-handle"></span>
                  &nbsp;<input type="checkbox" {% for sort in courseSetting.userinfoFields %}{% if sort=="job"%}checked=true{% endif %}{% endfor %} name="userinfoFields[]" value="job"></input><input type="hidden"  name="userinfoFieldNameArray[]" value="job"></input> 职业
                </li>
               {% endif %}
               {% if sort=='weibo' %}
                <li class="list-group-item clearfix" data-role="item" >
                  <span class="glyphicon glyphicon-resize-vertical sort-handle"></span>
                  &nbsp;<input type="checkbox" {% for sort in courseSetting.userinfoFields %}{% if sort=="weibo"%}checked=true{% endif %}{% endfor %} name="userinfoFields[]" value="weibo"></input><input type="hidden"  name="userinfoFieldNameArray[]" value="weibo"></input> 微博
                </li>
               {% endif %}
               {% if sort=='weixin' %}
                <li class="list-group-item clearfix" data-role="item" >
                  <span class="glyphicon glyphicon-resize-vertical sort-handle"></span>
                  &nbsp;<input type="checkbox" {% for sort in courseSetting.userinfoFields %}{% if sort=="weixin"%}checked=true{% endif %}{% endfor %} name="userinfoFields[]" value="weixin"></input><input type="hidden"  name="userinfoFieldNameArray[]" value="weixin"></input> 微信
                </li>
               {% endif %}
               {% if userFields %}
               {% for field in userFields %}
                {% if sort==field.fieldName %}
                <li class="list-group-item clearfix" data-role="item" >
                  <span class="glyphicon glyphicon-resize-vertical sort-handle"></span>
                  &nbsp;<input type="checkbox"  {% for sort in courseSetting.userinfoFields %}{% if sort==field.fieldName%}checked=true{% endif %}{% endfor %} name="userinfoFields[]" value="{{sort}}"></input><input type="hidden"  name="userinfoFieldNameArray[]" value="{{sort}}"></input> {{field.title}}
                </li>            
               {% endif %}
               {% endfor %}
               {% endif %}
            {% endfor %}
            {% else %}
            <li class="list-group-item clearfix" data-role="item" >
              <span class="glyphicon glyphicon-resize-vertical sort-handle"></span>
              &nbsp;<input type="checkbox" name="userinfoFields[]" value="truename" ></input><input type="hidden"  name="userinfoFieldNameArray[]" value="truename"></input> 真实姓名
            </li>
            <li class="list-group-item clearfix" data-role="item" >
              <span class="glyphicon glyphicon-resize-vertical sort-handle"></span>
              &nbsp;<input type="checkbox" name="userinfoFields[]" value="mobile" ></input><input type="hidden"  name="userinfoFieldNameArray[]" value="mobile"></input> 手机号码(带格式校检)
            </li>
              <li class="list-group-item clearfix" data-role="item" >
              <span class="glyphicon glyphicon-resize-vertical sort-handle"></span>
              &nbsp;<input type="checkbox" name="userinfoFields[]" value="qq"></input><input type="hidden"  name="userinfoFieldNameArray[]" value="qq"></input> QQ（带格式校验）
            </li>
            <li class="list-group-item clearfix" data-role="item" >
              <span class="glyphicon glyphicon-resize-vertical sort-handle"></span>
              &nbsp;<input type="checkbox" name="userinfoFields[]" value="company"></input><input type="hidden"  name="userinfoFieldNameArray[]" value="company"></input> 所在公司
            </li>
            <li class="list-group-item clearfix" data-role="item" >
              <span class="glyphicon glyphicon-resize-vertical sort-handle"></span>
              &nbsp;<input type="checkbox" name="userinfoFields[]" value="job"></input><input type="hidden"  name="userinfoFieldNameArray[]" value="job"></input> 职业
            </li>
            <li class="list-group-item clearfix" data-role="item" >
              <span class="glyphicon glyphicon-resize-vertical sort-handle"></span>
              &nbsp;<input type="checkbox" name="userinfoFields[]" value="gender"></input><input type="hidden"  name="userinfoFieldNameArray[]" value="gender"></input> 性别
            </li>
            <li class="list-group-item clearfix" data-role="item" >
              <span class="glyphicon glyphicon-resize-vertical sort-handle"></span>
              &nbsp;<input type="checkbox" name="userinfoFields[]" value="idcard"></input><input type="hidden"  name="userinfoFieldNameArray[]" value="idcard"></input> 身份证号码(带格式校检)
            </li>
              <li class="list-group-item clearfix" data-role="item" >
              <span class="glyphicon glyphicon-resize-vertical sort-handle"></span>
              &nbsp;<input type="checkbox" name="userinfoFields[]" value="weibo"></input><input type="hidden"  name="userinfoFieldNameArray[]" value="weibo"></input> 微博
            </li>
              <li class="list-group-item clearfix" data-role="item" >
              <span class="glyphicon glyphicon-resize-vertical sort-handle"></span>
              &nbsp;<input type="checkbox" name="userinfoFields[]" value="weixin"></input><input type="hidden"  name="userinfoFieldNameArray[]" value="weixin"></input> 微信
            </li>
            {% if  userFields %}
                {% for field in userFields %}
                    <li class="list-group-item clearfix" data-role="item" >
                      <span class="glyphicon glyphicon-resize-vertical sort-handle"></span>
                      &nbsp;<input type="checkbox" name="userinfoFields[]" value="{{field.fieldName}}"></input><input type="hidden"  name="userinfoFieldNameArray[]" value="{{field.fieldName}}"></input> {{field.title}}
                    </li>
                {% endfor %}
            {% endif %}
          {% endif %}
            </ul><div style="text-align:center;"><a href="javascript:" id="hide-list-btn">收起 <span class="
glyphicon glyphicon-chevron-up"></span></a></div>
  </div></div>

    </div>

    <div class="form-group">
      <div class="col-md-3 control-label">
        <label >允许教师设置课程价格</label>
      </div>
      <div class="controls col-md-8 radios">
        {{ radios('teacher_modify_price', {1:'是', 0:'否'}, courseSetting.teacher_modify_price) }}
      </div>
    </div>

    <div class="form-group">
      <div class="col-md-3 control-label">
        <label >允许教师添加/移除学员</label>
      </div>
      <div class="controls col-md-8 radios">
        {{ radios('teacher_manage_student', {1:'是', 0:'否'}, courseSetting.teacher_manage_student) }}
      </div>
    </div>

    <div class="form-group">
      <div class="col-md-3 control-label">
        <label >允许教师导出学员资料</label>
      </div>
      <div class="controls col-md-8 radios">
        {{ radios('teacher_export_student', {1:'是', 0:'否'}, courseSetting.teacher_export_student) }}
      </div>
    </div>

    <div class="form-group">
      <div class="col-md-3 control-label">
        <label >允许学员下载课时的音视频</label>
      </div>
      <div class="controls col-md-8 radios">
        {{ radios('student_download_media', {0:'不允许', 1:'允许'}, courseSetting.student_download_media) }}
        <div class="help-block">开启此项设置后，学员可在课时学习界面侧栏的"资料"面板中下载。</div>
      </div>
    </div>

    <div class="form-group">
      <div class="col-md-3 control-label">
        <label>课程详情页显示相关课程</label>
      </div>
      <div class="controls col-md-8 radios">
        {{ radios('relatedCourses', {1:'开启', 0:'关闭'}, courseSetting.relatedCourses) }}
        <div class="help-block">根据课程的标签，显示相关课程</div>
      </div>
    </div>
    <div class="form-group">
      <div class="col-md-3 control-label">
        <label>免费课程允许未登录用户观看</label>
      </div>
      <div class="controls col-md-8 radios">
        {{ radios('allowAnonymousPreview', {1:'允许', 0:'不允许'}, courseSetting.allowAnonymousPreview) }}
        <div class="help-block">如果允许此项设置,未登录用户（游客）可观看免费课程</div>
      </div>
    </div>

     <div class="form-group">
      <div class="col-md-3 control-label">
        <label>图文课时防复制</label>
      </div>
      <div class="controls col-md-8 radios">
        {{ radios('copy_enabled', {1:'开启', 0:'关闭'}, courseSetting.copy_enabled) }}
        <div class="help-block"></div>
      </div>
    </div>

    <div class="form-group">
      <div class="col-md-3 control-label">
        <label>课程图片预览</label>
      </div>
      <div class="controls col-md-8 radios">
        {{ radios('picturePreview_enabled', {1:'开启', 0:'关闭'}, courseSetting.picturePreview_enabled) }}
        <div class="help-block">如果允许此项设置,点击课程图片预览课程首个免费视频</div>
      </div>
    </div>

{#     <div class="form-group">
      <div class="col-md-3 control-label">
        <label>免费课程允许未登录用户观看</label>
      </div>
      <div class="controls col-md-8 radios">
        {{ radios('free_course_nologin_view', {1:'不允许', 0:'允许'}, courseSetting.free_course_nologin_view) }}
      </div>
    </div> #}

  </fieldset>
  <fieldset>
    <legend id="live-course-set">直播课程</legend>

    <div class="form-group">
      <div class="col-md-3 control-label">
        <label >开启状态</label>
      </div>
      <div class="controls col-md-8 radios">
        {{ radios('live_course_enabled', {1:'开启', 0:'关闭'}, courseSetting.live_course_enabled) }}
      </div>
    </div>
    
    <div class="form-group">
      <div class="col-md-3 control-label">
        <label for="logo">直播LOGO</label>
      </div>
      <div class="col-md-8 controls">
        <div id="live-course-logo-container">{% if courseSetting.live_logo|default(false) %}<img src="{{ asset(courseSetting.live_logo) }}">{% endif %}</div>
        <button class="btn btn-default btn-sm" id="live-course-logo-upload" type="button" data-url="{{ path('admin_setting_live_logo_upload') }}">上传</button>
        <button class="btn btn-default btn-sm" id="live-course-logo-remove" type="button" data-url="{{ path('admin_setting_live_logo_remove') }}" {% if not courseSetting.live_logo|default(false) %}style="display:none;"{% endif %}>删除</button>
        <p class="help-block">
          <b>只针对直播新方案。</b><br>
          请上传png, gif, jpg格式的图片文件。LOGO图片建议不要超过100*23。</p>
        <input type="hidden" name="live_logo" value="{{ courseSetting.live_logo|default("") }}">
      </div>
    </div>

    <div class="form-group">
      <div class="col-md-3 control-label">
        <label>同时在线人数上限</label>
      </div>
      <div class="controls col-md-8">
        <div class="mts text-muted" >{{ courseSetting.live_student_capacity }}人</div>
        <input class="form-control" name="live_student_capacity" type="hidden" data-value="{{ courseSetting.live_student_capacity }}">
        <p class="help-block"><a href="http://www.edusoho.com/services/liveroom" target="_blank">点击查看如何购买扩充在线人数</a></p>
      </div>
    </div>

  </fieldset>

  <div class="form-group">
    <div class="controls col-md-offset-3 col-md-8">
      <button type="submit" class="btn btn-primary">提交</button>
    </div>
  </div>
  <input type="hidden" name="_csrf_token" value="{{ csrf_token('site') }}">
</form>

{% endblock %}



